<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript 基础知识3</title>
    <script src="main.js"></script>
    <script>
        window.documentonload(clock())
    </script>


</head>

<body>
    <input type="text" id="clock" />
    <script language=javascript>
        var int = setInterval("clock()", 50);
        function clock() {
            var t = new Date();
            document.getElementById("clock").value = t
        }
    </script>
    <button onclick="int=window.clearInterval(int)">Stop interval</button>
</body>

</html>